package com.element.security.exception;

import com.common.core.results.VoidResult;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @auther zhangwj
 * @date 2021/3/24 下午5:22
 */
@JsonSerialize(using = AuthExceptionSerializer.class)
public class AuthException extends OAuth2Exception {

    private VoidResult result;

    public static AuthException getInstance(VoidResult result) {
        return new AuthException(result);
    }

    public AuthException(String msg) {
        super(msg);
    }

    public AuthException(VoidResult result) {
        super(result.getErrMsg());
        this.result = result;
    }

    public VoidResult getResult() {
        return result;
    }

    public void setResult(VoidResult result) {
        this.result = result;
    }
}
